<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

   <title>DREAM Toolbox - allcomb</title>

   <meta name="keywords" content="allcomb">

   <meta name="description" content="allcomb">

   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  
   <meta name="robots" content="index, follow">

   <meta author="Jurriaan H. Spaaks">

   <link type="text/css" rel="stylesheet" href="styles/dream_styles.css">
 
</head>



<body>
<a name="_top"></a>



<div class="linkheader">
<a href="matlab:edit(fullfile(dreamroot,'allcomb'))">View source code of the function <span style="font-family:monospace">allcomb()</span> in the MATLAB editor</a><br><br>
<a href="matlab:web(fullfile(dreamroot,'html','contents.html'),'-helpbrowser')">Toolbox contents</a>
</div>

<div class="spacer">
</div>



<div class="h1">
allcomb
</div>

<div class="h2">
Syntax
</div>

<div class="txt">
<pre>B = allcomb(A1,A2,A3,...,AN)</pre>
</div>

<div class="h2">
Description
</div>

<div class="txt">
<p>This function gives all possible combinations of the elements of vectors A1,A2,A3,...,AN. It was implemented by Jos van der Geest. See <a href="matlab: web('http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=10064&objectType=FILE', '-browser')">www.mathworks.com</a> for more information.</p>

<pre>
% ALLCOMB - All combinations
%    B = ALLCOMB(A1,A2,A3,...,AN) returns all combinations of the elements
%    in A1, A2, ..., and AN. B is P-by-N matrix in which P is
%    prod(numel(A1),..,numel(AN)). Empty inputs are ignored.
%
%    Example:
%    allcomb([1 3 5],[-3 8],[],[0 1]) ;
%       1  -3   0
%       1  -3   1
%       1   8   0
%       ...
%       5  -3   1
%       5   8   0
%       5   8   1
%    
%    ALLCOMB(A1,..AN,'matlab') causes the first column to change fastest.
%    This is more consistent with matlab indexing. Example:
%    allcomb(1:2,3:4,5:6,'matlab') %-> 
%      1   3   5
%      2   3   5
%      1   4   5
%      ...
%      2   4   6
%
%    This functionality is also known as the cartesion product.
%
%    See also PERMS, 
%    and COMBN (Matlab Central FEX)

% for Matlab R13
% version 1.0 (feb 2006)
% (c) Jos van der Geest
% email: jos@jasen.nl

% History
% 1.1 (feb 2006), removed minor bug in empty cell arrays; 
%     added option to let the first input run fastest (suggestion by JD)
</pre>

</div>


<div class="footer">
</div>

<div class="spacer">
</div>


<a name="_bottom"></a>


</body>

</html>